package chances.epg.ui.taglib.html;

import javax.servlet.jsp.JspException;

import chances.epg.ui.taglib.layout.BaseLayoutTag;
import chances.epg.ui.taglib.model.Rect;

@SuppressWarnings("serial")
public class SrcollerBarTag extends BaseLayoutTag {
	private int pageCount;
	private int pageNo;
	private int barStyle;
	private int barStyleClass;
	private boolean horizontal;
	private int size;
	private Rect barRect;
	private String image;
	@Override
	public void doAfterStart() throws JspException {
		super.doAfterStart();
		this.setVm("scrollerbar");
		int length = this.nativeRect.getHeight();
		if (horizontal) {
			length = this.nativeRect.getWidth();
		}
		int len = length / pageCount;
		int top = len * (pageNo - 1);
		if (horizontal) {
			int left = (this.nativeRect.getHeight() - size) / 2;
			barRect = new Rect(top, left, len, size);
		} else {
			int left = (this.nativeRect.getWidth() - size) / 2;
			barRect = new Rect(left, top, size, len);
		}
	
	}

	public void setHorizontal(boolean horizontal) {
		this.horizontal = horizontal;
	}

	public int getPageCount() {
		return pageCount;
	}

	public int getPageNo() {
		return pageNo;
	}

	public boolean isHorizontal() {
		return horizontal;
	}

	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}

	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}

	public int getBarStyle() {
		return barStyle;
	}

	public int getBarStyleClass() {
		return barStyleClass;
	}

	public void setBarStyle(int barStyle) {
		this.barStyle = barStyle;
	}

	public void setBarStyleClass(int barStyleClass) {
		this.barStyleClass = barStyleClass;
	}

	public int getSize() {
		return size;
	}

	public Rect getBarRect() {
		return barRect;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public void setBarRect(Rect barRect) {
		this.barRect = barRect;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	
}
